#pragma once

#include <memory>
#include "localsocket.hpp"
#include "localepoller.hpp"
#include "localconnection.hpp"

namespace Local_Connection
{
    int _defaultport = 8080;
    class LocalListener : public LocalConnection
    {
    public:
        /**********构造析构************** */
        LocalListener(int port = _defaultport)
            : _port(port),
              _listensock(std::make_unique<Local_Socket::TcpSocket>())
        {
            _listensock->ServerTcpMod(_port);
            SetEvent(EPOLLIN);
            SetFd(_listensock->GetFd());
        }
        ~LocalListener() {}

        /**********virtual************** */
        void Recver()
        {
            Local_Log::LOG(Local_Log::LogLever::LDEBUG) << "connection Recver ";
            
        }
        void Sender()
        {
            Local_Log::LOG(Local_Log::LogLever::LDEBUG) << "connection Sender ";
        }
        void Excepter()
        {
            Local_Log::LOG(Local_Log::LogLever::LDEBUG) << "connection Excepter ";
        }

    private:
        int _port;
        std::unique_ptr<Local_Socket::Socket> _listensock;
    };
}